using Headspring.Training.Domain.Services;

namespace Headspring.Training.Domain.Model.StateCommands
{
	public class InProgressToCompleteCommand : StateCommandBase
	{
		public InProgressToCompleteCommand(WorkOrder workOrder, Employee currentUser) : base(workOrder, currentUser)
		{
		}

		public override string TransitionVerbPresentTense
		{
			get { return "Complete"; }
		}

		public override string TransitionVerbPastTense
		{
			get { return "Completed"; }
		}

		public override WorkOrderStatus GetBeginStatus()
		{
			return WorkOrderStatus.InProgress;
		}

		protected override WorkOrderStatus GetEndStatus()
		{
			return WorkOrderStatus.Complete;
		}

		protected override bool userCanExecute(Employee currentUser)
		{
			return currentUser == _workOrder.Assignee;
		}

		protected override void postExecute(IWorkflowCoordinator coordinator)
		{
			coordinator.SendNotification(this, _workOrder);
			coordinator.EditWorkOrder(_workOrder);
		}
	}
}